<template>
  <div>
    <i class="el-icon-arrow-left m-b-20" @click="back"></i>
    <el-descriptions
      title="开票信息"
      :extra="'申请时间:' + info.applyTime"
      :column="6"
      :colon="false"
      direction="vertical"
      border
    >
      <el-descriptions-item
        label="用户昵称"
        label-class-name="my-label"
        content-class-name="my-content"
        >{{ info.userNickName }}</el-descriptions-item
      >
      <el-descriptions-item
        label="开票金额（元）"
        label-class-name="my-label"
        content-class-name="my-content"
        >{{ info.invoiceMoney }}</el-descriptions-item
      >
      <el-descriptions-item
        label="加注总量（kg）"
        label-class-name="my-label"
        content-class-name="my-content"
        >待询问</el-descriptions-item
      >
      <el-descriptions-item
        label="开票状态"
        label-class-name="my-label"
        content-class-name="my-content"
      >
        <span v-if="info.applyStatus == 0">未开票</span>
        <span v-if="info.applyStatus == 1">已开票</span>
      </el-descriptions-item>
      <el-descriptions-item
        label="开票时间"
        label-class-name="my-label"
        content-class-name="my-content"
        >{{ info.completeTime }}</el-descriptions-item
      >
      <el-descriptions-item
        label="备注"
        label-class-name="my-label"
        content-class-name="my-content"
        >{{ info.invoiceRemark }}</el-descriptions-item
      >
    </el-descriptions>
    <div class="m-t-20"></div>
    <h4 class="m-b-20">发票申请信息</h4>
    <div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">发票抬头</span>
        <span>{{ info.headTitle }}</span>
      </div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">纳税人识别码</span>
        <span>{{ info.taxNo }}</span>
      </div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">纳税人地址</span>
        <span>{{ info.address }}</span>
      </div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">纳税人电话</span>
        <span>{{ info.userPhone }}</span>
      </div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">纳税人开户行</span>
        <span>{{ info.bankName }}</span>
      </div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">纳税人银行账号</span>
        <span>{{ info.bankAccount }}</span>
      </div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">收件人姓名</span>
        <span>待询问</span>
      </div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">收件人电话</span>
        <span>待询问</span>
      </div>
      <div class="m-t-20 flex-start f-s-14">
        <span class="w-100px c-gray flex-end m-r-20">收件人地址</span>
        <span>待询问</span>
      </div>
    </div>
    <div class="m-t-25 flex-end w-50">
      <el-button type="primary" plain size="small" @click="back"
        >返回</el-button
      >
    </div>
  </div>
</template>

<script>
import {
  getList,
  getUser,
  remove,
  update,
  add,
  grant,
  resetPassword,
} from "@/api/system/user";
import { mapGetters } from "vuex";

export default {
  data() {
    return {
      form: {},
      data: [],
    };
  },
  computed: {
    ...mapGetters(["permission"]),
  },
  props: {
    info: {
      type: Object,
    },
  },
  methods: {
    back() {
      this.$emit("back");
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
      });
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
  },
};
</script>

<style lang="scss">
.el-descriptions__header {
  background: #f8fafd;
  border: 1px solid #eee;
  line-height: 40px;
  padding: 0 10px;
  margin: 0;
}
.my-label {
  font-weight: bold !important;
  background: #fff !important;
  color: #000 !important;
  border-bottom: 1px solid #eee;
  border-top: 0px solid #eee;
}
</style>
